/**
 * Created by lenovo on 2016/5/29.
 */
public class Tthread implements Runnable {

    public void run() {

        boolean fo = true;

        int Y = 0, X = 0;

        JLabel show = new JLabel();

        show.setFont(new java.awt.Font("宋体", Font.PLAIN, 33));

        jPanel1.add(show);

        X = 10 + (int) (Math.random() * 400);

        String parameter = list[(int) (Math.random() * list.length)] + "";

        Bean bean = new Bean();

        bean.setParameter(parameter);

        bean.setShow(show);

        number.add(bean);

        show.setText(parameter);

        while (fo) {

            // ---------------------数字下移--------------------

            show.setBounds(new Rectangle(X, Y += 2, 33, 33));

            try {

                Thread.sleep(rapidity);

            } catch (InterruptedException e) {

                e.printStackTrace();

            }

            if (Y >= 419) {

                fo = false;

                for (int i = number.size() - 1; i >= 0; i--) {

                    Bean bn = ((Bean) number.get(i));

                    if (parameter.equalsIgnoreCase(bn.getParameter())) {

                        cuowu += 1;

                        jLabel2.setText("正确:" + zhengque + "个,错误:" + cuowu + "个");

                        number.removeElementAt(i);

                        Music_shibai.play();

                        break;

                    }

                }

            }

        }

    }
}
